package com.mk.sso.boot;

import com.mk.sso.sdk.conf.SsoConf;
import com.mk.sso.sdk.properties.AjaxFailureResponse;
import lombok.Getter;
import lombok.Setter;
import com.mk.sso.boot.annotation.StrValueRange;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotEmpty;

@Setter
@Getter
@Validated
@ConfigurationProperties(prefix = "easy.sso.client")
public class SsoProperties {

    // 是否启用
    private boolean enable;

    // 应用类型(默认web服务)
    @StrValueRange(values = {SsoConf.WEB_CLIENT, SsoConf.APP_CLIENT},message = "clientType只能为web或app")
    private String clientType = SsoConf.WEB_CLIENT;

    //放行的url
    private  String[] ignoreUrls = {};

    //放行的资源文件
    private  String[] ignoreResources = {".js", ".css", ".jpg", ".png", ".ico", ".html"};

    // sso服务器地址
    @NotEmpty
    private String ssoServer;

    // 退出url
    @StrValueRange(values = {SsoConf.WEB_CLIENT_LOGOUT_URL, SsoConf.APP_CLIENT_LOGOUT_URL})
    private String logoutUrl = SsoConf.WEB_CLIENT_LOGOUT_URL;

    // 登录url
    @NotEmpty
    private String loginUrl;

    // ajax请求认证失败响应
    private AjaxFailureResponse ajaxFailureResponse;

}
